*/
protected $file;
protected $archiveName;
-
+
protected $params;
public function __construct( $main, $action ) {
$this->params = $this->extractRequestParams();
$this->validateParameters();
-
+
$sourceUrl = $this->file->getArchiveVirtualUrl( $this->archiveName );
$status = $this->file->upload( $sourceUrl, $this->params['comment'], $this->params['comment'] );
-
+
if ( $status->isGood() ) {
$result = array( 'result' => 'Success' );
} else {
'errors' => $this->getResult()->convertStatusToArray( $status ),
);
}
-
+
$this->getResult()->addValue( null, $this->getModuleName(), $result );
}
}
}
}
-
+
/**
* Validate the user parameters and set $this->archiveName and $this->file.
* Throws an error if validation fails
if ( !$this->file->exists() ) {
$this->dieUsageMsg( array( 'notanarticle' ) );
}
-
+
// Check if the archivename is valid for this file
$this->archiveName = $this->params['archivename'];
$oldFile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $this->archiveName );
$this->dieUsageMsg( array( 'filerevert-badversion' ) );
}
}
-
-
public function mustBePosted() {
return true;
$this->getResult()->addValue( null, $this->getModuleName(), $r );
}
+ /**
+ * @param Title $fromTitle
+ * @param Title $toTitle
+ * @param $reason
+ * @param $noredirect
+ * @return array
+ */
public function moveSubpages( $fromTitle, $toTitle, $reason, $noredirect ) {
$retval = array();
$success = $fromTitle->moveSubpages( $toTitle, true, $reason, !$noredirect );
var $fileFromRowFactory = array( 'LocalFile', 'newFromRow' );
var $oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow' );
+ /**
+ * @throws MWException
+ * @param $row
+ * @return File
+ */
function newFileFromRow( $row ) {
if ( isset( $row->img_name ) ) {
return call_user_func( $this->fileFromRowFactory, $row, $this );